package com.itheima.thread.阻塞队列.demo1;

import java.util.concurrent.ArrayBlockingQueue;

public class Demo {
    public static void main(String[] args) throws InterruptedException {
        //创建一个阻塞队列
        ArrayBlockingQueue<String> abq = new ArrayBlockingQueue<>(1);
        //存入数据
        abq.put("汉堡包1");
        //取出数据
        System.out.println(abq.take());
        //当无法放入或取出时,程序陷入阻塞状态
        System.out.println(abq.take());
    }
}
